﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace WebApp
{
    /// <summary>
    /// Summary description for WebService
    /// </summary>
    [WebService(Namespace = "http://localhost/MyWebServices/")]
    //[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class WebService : System.Web.Services.WebService
    {

        [WebMethod]
        public string HelloWorld()
        {
            return "Hello World";
        }

        [WebMethod]
        public List<country> getCountry()
        {
            IDAO a = new MyLinq();
            return a.getCountry();
        }

        [WebMethod]
        public country getCountry(int id)
        {
            IDAO a = new MyLinq();
            return a.getCountry(id);
        }

        [WebMethod]
        public trip getTrip(int id)
        {
            IDAO a = new MyLinq();
            return a.getTrip(id);
        }

        [WebMethod]
        public List<trip> getTrips(int min_price, int max_price, int country, DateTime date_begin, DateTime date_end)
        {
            IDAO a = new MyLinq();
            return a.getTrips(min_price, max_price, country, date_begin, date_end);

        }

        [WebMethod]
        public int addUser(string login, string password, string email)
        {
            IDAO a = new MyLinq();
            return a.addUser( login,  password,  email);
        }


        [WebMethod]
        public user checkLogin(string username, string password)
        {
            IDAO a = new MyLinq();
            return a.checkLogin(username, password);
        }

        [WebMethod]
        public List<reservation> getReservations(int person)
        {
            IDAO a = new MyLinq();
            return a.getReservations(person);
        }

        [WebMethod]
        public void addReservation(int trip_id, int person_id, int company_id, int person_count)
        {
            IDAO a = new MyLinq();
            a.addReservation( trip_id,  person_id,  company_id, person_count);
        }

    }
}
